home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
oath.lha
/
oath
/
test
/
dll2b.cc
< prev
next >
Wrap
C/C++ Source or Header
|
1991-08-29
|
2KB
|
77 lines
#include "oath/dlList.h"
#include "oath/character.h"
#include <fstream.h>
/////////////////////////////////////////////////////////////////////////////
// Test of dlLists
main ()
{// Predefine Four Characters //////////
characterA A = characterA::make('A');
characterA B = characterA::make('B');
characterA C = characterA::make('C');
characterA D = characterA::make('D');
cout << A << B << C << D << endl;
// Retrieve the Three Lists //////////
ifstream File ("dll2.obj");
listA LN = listA::isa(objA::import(File));
dlListA L1 = dlListA::isa(LN[0]);
dlListA L2 = dlListA::isa(LN[1]);
dlListA L3 = dlListA::isa(LN[2]);
// Test Code //////////
if(L1.is(L2) || L1.is(L3))
cout << "is() failed!" << endl;
else
cout << "is() succeeded!" << endl;
if(L1 == L2 && L1 == L3)
cout << "== succeeded!" << endl;
else
cout << "== failed!" << endl;
if(L1.isEmpty() || L2.isEmpty() || L3.isEmpty())
cout << "isEmpty() failed!" << endl;
else
cout << "isEmpty() succeeded!" << endl;
if(L1.contains(A) && L1.contains(B) && !L1.contains(D))
cout << "contains() succeeded!" << endl;
else
cout << "contains() failed!" << endl;
cout << "There are " << L1.count() << " characters in L1: ";
posA P1 = L1.makePos();
while(P1())
{cout << characterA::isa(*P1);
++P1;
}
cout << endl;
cout << "The second character is "
<< characterA::isa(L1[1]) << endl;
objA O;
L2 >> O;
cout << "The first character removed is "
<< characterA::isa(O) << endl;
cout << "There are " << L2.count() << " characters in L2: ";
posA P2 = L2.makePos();
while(P2())
{cout << characterA::isa(*P2);
++P2;
}
cout << endl;
}